{% extends "base.html" %}
{% set title = "添加学生" %}

{% block content %}
    <h2>添加学生</h2> 
    <form action="{{ url_for('add_student') }}" method="post">
        
        <div class="form-group">
            <label for="username">姓名</label>
            <input type="text" class="form-control" id="username" name="username" required>
        </div>

        <div class="form-group">
            <label for="age">年龄</label>
            <input type="number" class="form-control" id="age" name="age" required>
        </div>
        
        <div class="form-group">
            <label for="gender">性别</label>
            <select class="form-control" id="gender" name="gender" required>
                <option value="男">男</option>
                <option value="女">女</option>
            </select>
        </div>

        <div class="form-group">
            <label for="major">专业</label>
            <select class="form-control" id="major_id" name="major_id">
                <option value="无专业">无专业</option>
                {% for major in majors %}
                <option value="{{ major.id }}">{{ major.name }}</option>
                {% endfor %}
            </select>
        </div>
        <br>
        
        <button type="submit" class="btn btn-primary">添加</button>
        
    </form>
    <br>
    <a href="{{ url_for('list_students') }}" class="btn btn-secondary">返回学生列表</a>
    <br>
{% endblock %}